home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_313 / uucp / uucp1.lzh / man / Grep < prev    next >
Text File  |  1989-10-14  |  4KB  |  101 lines

  1.  
  2. NAME
  3.      grep, - search file for regular expression
  4.  
  5. SYNTAX
  6.      grep [option...] expression [file...]
  7.  
  8. DESCRIPTION
  9.      The grep command searchs the input files (standard input
  10.      default) for lines matching a pattern.  Normally, each
  11.      line found is copied to the standard output.  The grep com-
  12.      mand patterns are limited regular expressions in the style
  13.      of ex(1), which uses a compact nondeterministic algorithm.
  14.  
  15.      In all cases the file name is shown if there is more than
  16.      one input file.  Care should be taken when using the charac-
  17.      ters $ * [ ^ | ( ) and \ in the expression as they are also
  18.      meaningful to some Shells. It is safest to enclose the
  19.      entire expression argument in single quotes ' '.
  20.  
  21.           A \ followed by a single character other than new line
  22.           matches that character.
  23.  
  24.           The character ^ matches the beginning of a line.
  25.  
  26.           The character $ matches the end of a line.
  27.  
  28.           A . (period) matches any character.
  29.  
  30.           A single character not otherwise endowed with special
  31.           meaning matches that character.
  32.  
  33.           A string enclosed in brackets [] matches any single
  34.           character from the string.  Ranges of ASCII character
  35.           codes may be abbreviated as in `a-z0-9'.  A ] may occur
  36.           only as the first character of the string.  A literal -
  37.           must be placed where it can't be mistaken as a range
  38.           indicator.
  39.  
  40.           A regular expression followed by an * (asterisk)
  41.           matches a sequence of 0 or more matches of the regular
  42.           expression.  A regular expression followed by a +
  43.           (plus) matches a sequence of 1 or more matches of the
  44.           regular expression.  A regular expression followed by a
  45.           ? (question mark) matches a sequence of 0 or 1 matches
  46.           of the regular expression.
  47.  
  48.           Two regular expressions concatenated match a match of
  49.           the first followed by a match of the second.
  50.  
  51.           Two regular expressions separated by | or new line
  52.           match either a match for the first or a match for the
  53.           second.
  54.  
  55.           A regular expression enclosed in parentheses matches a
  56.           match for the regular expression.
  57.  
  58.      The order of precedence of operators at the same parenthesis
  59.      level is [] then *+? then concatenation then | and new line.
  60.  
  61.      Ideally there should be only one grep, but we don't know a
  62.      single algorithm that spans a wide enough range of space-
  63.      time tradeoffs.
  64.  
  65. OPTIONS
  66.      -b Precedes each output line with its block number.  This is
  67.         sometimes useful in locating disk block numbers by con-
  68.         text.
  69.  
  70.      -c Produces count of matching lines only.
  71.  
  72.      -e expression
  73.         Uses next argument as expression that begins with a minus
  74.         (-).
  75.  
  76.      -i Considers upper and lowercase letter identical in making
  77.         comparisons.
  78.  
  79.      -l Lists files with matching lines only once, separated by a
  80.         new line.
  81.  
  82.      -n Precedes each matching line with its line number.
  83.  
  84.      -s Silent mode and nothing is printed (except error mes-
  85.         sages).  This is useful for checking the error status
  86.  
  87.      -v Displays all lines that do not match specified expres-
  88.         sion.
  89.  
  90.      -w Searches for an expression as for a word (as if sur-
  91.         rounded by `\<' and `\>').
  92.  
  93. RESTRICTIONS
  94.      Lines are limited to 256 characters; longer lines are trun-
  95.      cated.
  96.  
  97. DIAGNOSTICS
  98.      Exit status is 0 if any matches are found, 1 if none, 2 for
  99.      syntax errors or inaccessible files.
  100.  
  101.